SET(CMAKE_MODULE_PATH "${ZCACHE_SOURCE_DIR}/cmake/modules")

FIND_PACKAGE(APR REQUIRED)
FIND_PACKAGE(APR-UTIL REQUIRED)

IF(APR_FOUND)
	INCLUDE_DIRECTORIES(${APR_INCLUDE_DIR})
	SET(HAVE_LIBAPR 1)
ENDIF(APR_FOUND)

IF(APR-UTIL_FOUND)
	INCLUDE_DIRECTORIES(${APR-UTIL_INCLUDE_DIR})
	SET(HAVE_LIBAPR-UTIL 1)
ENDIF(APR-UTIL_FOUND)

SET(SRC zcache.c 
        zcache_util_mutex.c
	zcache_shmcb.c
	unixd_mutex.c
	testzcache.c
	)

ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE -DFILE_OFFSET_BITS=64 -O0 -g -Wall)
#SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall")
#-pg for gprof
#SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -O3 -Wall")

SET(INC_DIRS ${TRACK_SERVER_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${INC_DIRS})

#SET(LINK_DIRS /home/kacha/dev/apr/lib /home/kacha/dev/apr-util/lib)
#LINK_DIRECTORIES(${LINK_DIRS})

ADD_EXECUTABLE(testzcache ${SRC})
TARGET_LINK_LIBRARIES(testzcache ${APR_LIBRARIES} ${APR-UTIL_LIBRARIES})
INSTALL(TARGETS testzcache RUNTIME DESTINATION bin)

